/**
 * 👨‍💻 伟谭
 * 📅 2017/11/25
 */

#import "TWBriefIntroductionToTheConvenienceServiceCollectionViewCell.h"

@interface TWBriefIntroductionToTheConvenienceServiceCollectionViewCell()

//店铺名称
@property(nonatomic,strong) UILabel *lblCompayName;

//类别状态
@property(nonatomic,strong) UIButton *btnClassStatus;

//业务概述
@property(nonatomic,strong) UILabel *lblBusinessSummary;

//位置
@property(nonatomic,strong) UIButton *btnAddress;

//发布时间
@property(nonatomic,strong) UILabel *lblReleaseDateTime;

//发布时间
@property(nonatomic,strong) UILabel *lblBrowseTheNumberInstruction;

@end

@implementation TWBriefIntroductionToTheConvenienceServiceCollectionViewCell

#pragma mark - Class method

#pragma mark - Life cycle

#pragma mark - Override


-(instancetype)initWithFrame:(CGRect)frame {
    
   
    if(self){
    
        self =[super initWithFrame:frame];
        self.backgroundColor = [UIColor whiteColor];
        //店铺名称
        UILabel *lblCompayName = [UILabel hj_labelWithText:@"重庆气息搬家服务有限公司" textColor:nil font:nil];
        [self.contentView addSubview:lblCompayName];
        _lblCompayName = lblCompayName;
        
        
        //类别状态
        UIButton *btnClassStatus = [UIButton hj_buttonWithTitle:@"优质商家" tintColor:nil font:FontL(12.0f) touchUpInsideTarget:nil action:nil];
        
        btnClassStatus.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
        btnClassStatus.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
        
        btnClassStatus.clipsToBounds = YES;
        btnClassStatus.layer.cornerRadius = 4.0f;
        btnClassStatus.layer.borderWidth =1.0f;
        btnClassStatus.layer.borderColor = [UIColor redColor].CGColor;
        btnClassStatus.contentEdgeInsets = UIEdgeInsetsMake(2.0, 4.0f, 4.0f, 2.0f);
        
        [self.contentView addSubview:btnClassStatus];
        _btnClassStatus = btnClassStatus;
        
        //业务概述
        UILabel *lblBusinessSummary = [UILabel hj_labelWithText:@"公司搬家，居民搬家，长途运输，正规公司值得信赖" textColor:[UIColor grayColor] font:FontL(15.0f)];
        lblBusinessSummary.numberOfLines = 2.0f;
        [self.contentView addSubview:lblBusinessSummary];
        _lblBusinessSummary = lblBusinessSummary;
        
        //位置
        UIButton *btnAddress = [UIButton hj_buttonWithTitle:@"重庆劳动二村谢家湾街道" titleColor:[UIColor grayColor] font:FontL(12.0f) backgroundColor:nil touchUpInsideTarget:nil action:nil];
        [btnAddress setImage:IMG(@"收货地址") forState:UIControlStateNormal];
        [btnAddress setTitleEdgeInsets:UIEdgeInsetsMake(0.0f, 6.0f, 0.0f, 0.0f)];
        [self.contentView addSubview:btnAddress];
        _btnAddress = btnAddress;
        
        
        //发布时间
        
        UILabel *lblReleaseDateTime = [UILabel hj_labelWithText:@"发布时间：2017-08-07" textColor:[UIColor grayColor] font:FontL(14.0f)];
        [self.contentView addSubview:lblReleaseDateTime];
        _lblReleaseDateTime = lblReleaseDateTime;
        
        //发布时间
        
        UILabel *lblBrowseTheNumberInstruction = [UILabel hj_labelWithText:@"已有16570浏览" textColor:[UIColor grayColor] font:FontL(14.0f)];
        [self.contentView addSubview:lblBrowseTheNumberInstruction];
        _lblBrowseTheNumberInstruction = lblBrowseTheNumberInstruction;
        
        [lblCompayName mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.offset(4.0f);
            make.top.offset(12.0f);
        }];
        
        [btnClassStatus mas_makeConstraints:^(MASConstraintMaker *make) {
           
            make.left.equalTo(lblCompayName.mas_right).offset(4.0f);
            make.centerY.equalTo(lblCompayName);
            
            
        }];
        
        [lblBusinessSummary mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(lblCompayName);
            make.top.equalTo(lblCompayName.mas_bottom).offset(6.0f);
            make.right.offset(-6.0f);
        }];
        
        [btnAddress mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(lblCompayName);
            make.top.equalTo(lblBusinessSummary.mas_bottom).offset(6.0f);
            make.width.offset([btnAddress sizeThatFits:CGSizeZero].width+8.0f);
            
        }];
        
        [lblReleaseDateTime mas_makeConstraints:^(MASConstraintMaker *make) {
           
            make.left.equalTo(lblCompayName);
            make.top.equalTo(btnAddress.mas_bottom).offset(6.0f);
            
        }];
        
        [lblBrowseTheNumberInstruction  mas_makeConstraints:^(MASConstraintMaker *make) {
           
            make.right.offset(-6.0f);
            make.centerY.equalTo(lblReleaseDateTime);
            
            
        }];
    }
    return self;
}

#pragma mark - Event response

#pragma mark - Protocol

#pragma mark <<#XXXDelegate#>>

#pragma mark - Public method

#pragma mark - Private method

#pragma mark - Getter & Setter

@end
